let loginBtns = document.querySelectorAll(".login-btns a")
let loginDiv = document.querySelectorAll(".box-right .login-box")
loginBtns.forEach(function (v, i) {
    v.addEventListener("click", function () {
        for (let x = 0; x < loginBtns.length; x++) {


            loginBtns[x].className = ""
            loginDiv[x].classList.remove("login-active")
        }

        this.className = "active"
        loginDiv[i].classList.add("login-active")
    })
})
// 首页登录验证
let deng = document.querySelector(".logo-btn")
let username = document.getElementById("username")
let password = document.getElementById("password")
let hezi = document.querySelector(".hezi")
let hezi1 = document.querySelector(".hezi1")
deng.addEventListener("click",function(){
    if(username.value.length<6 ||username.value.length>12){
        hezi.style.display = "block"
        let t = setTimeout(function(){
            hezi.innerHTML = "用户格式不正确"
            hezi.style.display = "none"
        },1000)
    }else if(password.value.leng <6||password.value.leng>12){
        hezi1.style.display = "block"
        let t = setTimeout(function(){
            hezi1.innerHTML = "密码格式不正确"
            hezi1.style.display = "none"
        },1000)
    }else{
        let t = setTimeout(function(){
            location.href="index.html"
        },4000)
    }
})
console.log(hezi)
// deng.addEventListener("click", function () {

//     let t = setInterval(function () {
       
//     }, 2000)
//     if (x < 0) {
//         clearInterval(t)
//         hezi.style.display = "none"
//     }
//     if (username.value.length <= 5) {
//         hezi.innerHTML = "用户格式不正确"
//         hezi.style.display = "block"
//     }
//     location.href = "index.html"
//     if (password.value.length < 6 || password.value.length > 12) {

//         hezi1.innerHTML = "密码格式不正确"
//         hezi1.style.color = "red"
//         hezi1.style.display = "block"
//         alert("密码格式不正确")

//     } else {
//         (password.value.length < 6 || password.value.length > 12)
//         hezi1.style.display = "none"
//         location.href = "index.html"
//     }
// })
// console.log(loginBtns)
// console.log(loginDiv)